package com.jt.controller.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jt.anno.Cache_Find;
import com.jt.pojo.Item;
import com.jt.pojo.ItemDesc;
import com.jt.service.ItemService;

@RestController
@RequestMapping("/web/item/")
public class WebItemController {
	@Autowired
	private ItemService itemService;
	
	/**
	 * 1.根据id查询商品
	 * url http://manage.jt.com/web/item/findItemById?itemId=562379-->/web/item/findItemById
	 */
	@RequestMapping("findItemById")
	@Cache_Find(seconds = 7*24*3600)
	public Item findItemById(Long itemId) {
		return itemService.findItemById(itemId);//返回JSON串的对象
	}
	
	/**
	 * 2.根据id查询商品描述信息
	 * url  http://manage.jt.com/web/item/findItemDescById?itemId=562379
	 */
	@RequestMapping("findItemDescById")
	@Cache_Find(seconds = 7*24*3600)
	public ItemDesc findItemDescById(Long itemId) {
		return itemService.findItemDescById(itemId);
	}
	
}
